#include "lab6_problem2.h"

#include <cassert>
#include <cmath>
#include <fstream>
#include <iostream>
#include <stdint.h>

#include "../p1/Interpolation.h"

namespace Lab6
{
    namespace Problem2
    {
        namespace 
        {
            double f1(const double x)
            {
            	return cos(x);
            }
        }
            
        void problem2()
        {
            std::cout << "Lab 6 - Problem 2:" << std::endl;
            
          	std::ofstream file;

          	file.open("lab6/p2/datos/out.txt");

           	assert(file && "Failed in file opening");

           	for(uint32_t i = 0; i <= 1000; ++i)
           		file << i << " " << NumericalAnalysis::CompositeTrapezoidRule(0.0, static_cast<double>(i), 0.005, f1) << std::endl;

           	file.close();
        }
    }
}
